package com.reactnativerecordwebview;

import android.app.Activity;

import java.lang.ref.WeakReference;

public class CustomActivityManager {
  private static CustomActivityManager mInstance = new CustomActivityManager();

  private WeakReference<Activity> sCurrentActivityWeakRef;

  public CustomActivityManager(){

  }

  public static CustomActivityManager getInstance(){
    return mInstance;
  }

  public Activity getCurrentActivity(){
    Activity currentActivity = null;
    if(sCurrentActivityWeakRef != null){
      currentActivity = sCurrentActivityWeakRef.get();
    }
    return currentActivity;
  }

  public void setCurrentActivity(Activity activity){
    sCurrentActivityWeakRef = new WeakReference<Activity>(activity);
  }

}
